package cn.buk.qms.service;

import cn.buk.common.JsonResult;
import cn.buk.common.dto.CommonDto;
import cn.buk.tms.dto.FlightChangeOrderDto;
import cn.buk.tms.entity.order.flight.FlightChangeOrderDetail;
import cn.buk.tms.entity.misc.OperationLog;
import cn.buk.tms.entity.order.OrderAttachment;
import cn.buk.tms.sc.SearchFlightOrderCriteria;
import cn.buk.tms.flight.dto.response.ChangeOrderResponseDto;

import java.util.List;

/**
 * 机票改签订单服务接口类
 * @author yfdai
 */
public interface FlightChangeOrderService {

    JsonResult createFlightChangeOrder(int enterpriseId, String username, FlightChangeOrderDto dto);

    JsonResult createFlightChangeOrderV2(int enterpriseId, String operator, FlightChangeOrderDto dto);

    List<ChangeOrderResponseDto> searchFlightChangeOrder(int enterpriseId, int userId, SearchFlightOrderCriteria sc);
    CommonDto<ChangeOrderResponseDto> searchFlightChangeOrder2(int enterpriseId, int userId, SearchFlightOrderCriteria sc);

    /**
     * 获取改签单详情
     *
     * @param enterpriseId 企业id
     * @param userId       用户id
     * @param id           订单id
     * @return ChangeOrderResponseDto
     */
    ChangeOrderResponseDto getFlightChangeOrderDetail(int enterpriseId, int userId, int id);

    List<OperationLog> searchFlightChangeOrderHistory(int enterpriseId, int id);

    JsonResult processFlightChangeOrder(int enterpriseId, String username, int orderId);

    JsonResult cancelFlightChangeOrder(int enterpriseId, String username, int orderId, String remark);

    JsonResult reopenFlightChangeOrder(int enterpriseId, String username, int orderId);

    /**
     * 改签单处理完成
     *
     * @param enterpriseId 企业id
     * @param username     用户名
     * @param orderId      订单id
     * @param pnrNo        新编码
     * @param ticketNo     新票号
     * @return 处理是否成功
     */
    JsonResult finishFlightChangeOrder(int enterpriseId, String username, int orderId, String pnrNo, String ticketNo);

    JsonResult updateChangeOrderSupplier(int enterpriseId, String username, int orderId, int supplierId);

    JsonResult updateChangeOrderPayment(int enterpriseId, String username, int orderId, int paymentMethodId);

    JsonResult updateChangeOrderRemark(int enterpriseId, String username, int orderId, String remark);

    /**
     * 修改改签单的票号
     *
     * @param enterpriseId 企业id
     * @param username     用户名
     * @param orderId      订单id
     * @param ticketNo     新票号
     * @return
     */
    JsonResult updateChangeOrderTicketNo(int enterpriseId, String username, int orderId, String ticketNo);

    JsonResult updateChangeOrderPrice(int enterpriseId, String username, int id, double airChangeCharge, double serviceCharge);

    /**
     * 修改改签的航班信息
     *
     * @param enterpriseId
     * @param username
     * @param id
     * @param detail
     * @return
     */
    JsonResult updateChangeOrderFlightInfo(int enterpriseId, String username, int id, FlightChangeOrderDetail detail);

    /**
     * 回滚改签单的状态
     *
     * @param enterpriseId
     * @param username
     * @param id
     * @return
     */
    JsonResult rollbackChangeOrderStatus(int enterpriseId, String username, int id, final String remark);

    /**
     * 改签单的短信内容
     *
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param smsFormat
     * @return
     */
    JsonResult getFlightChangeOrderSmsContent(int enterpriseId, String username, int orderId, int smsFormat);

    JsonResult sendFlightChangeOrderSms(int enterpriseId, String username, int orderId, String mobileNo, int smsFormat, String smsContent);



    /**
     * 刷新改签单票号状态
     *
     * @param enterpriseId
     * @param username
     */
    void refreshChangeOrderDetrDetail(int enterpriseId, String username);

    /**
     * 需要重新检查DETR信息的
     *
     * @param enterpriseId
     * @param username
     */
    void recheckChangeOrderDetrInfo(final int enterpriseId, final String username);

    /**
     * 改签单完成后，需要刷新其PNR
     *
     * @param enterpriseId 企业id
     * @param username     用户名
     */
    void refreshChangeOrderPnrDetail(int enterpriseId, String username);

    JsonResult saveChangeOrderAttachment(int enterpriseId, String username, int orderId, List<OrderAttachment> attachments);



    JsonResult sendWeixinTplMsg(int enterpriseId, int id);

    /**
     * 创建NDC的改签单
     */
    JsonResult createNdcOrderChange(int enterpriseId, String username, int orderId);

    /**
     * CZ NDC 查询改签单
     */
    JsonResult syncNdcOrderChangeInfo(int enterpriseId, String username, int orderId);

    /**
     * CZ NDC 改签单支付
     */
    JsonResult payForFlightChangeOrder(int enterpriseId, String username, int orderId);
}
